#pragma once

#include "Core.h"
#include "Core/Window.h"
#include "Events/ApplicationEvent.h"
#include "LayerStack.h"
#include "ImGui/ImGuiLayer.h"
#include "Core/Time.h"

namespace Orange
{
	class Application
	{
	public:
		Application(const std::string &name = "RPG App");
		virtual ~Application();

	public:
		void Run();
		void OnEvent(Event &e);
		bool OnWindowClose(WindowCloseEvent &e);
		bool OnWindowResize(WindowResizeEvent &e);

		void PushLayer(Layer *layer);
		void PushOverLayer(Layer *layer);
		static Application &Get()
		{
			return *m_instance;
		}
		Window &GetWindow()
		{
			return *m_Window;
		}

		ImGuiLayer *GetImGuiLayer() { return m_ImGuiLayer; };

	private:
		Scope<Window> m_Window;

		float m_lastFrameTime = 0.0f;

		ImGuiLayer *m_ImGuiLayer;
		bool m_Running = true;
		/// <summary>
		/// ��С������
		/// </summary>
		bool m_Minied = false;
		LayerStack m_LayerStack;
		static Application *m_instance;
	};
	Application *CreateApplication();
}
